/** @file store_mdb.h
 *
 * @brief LMDB graph store backend.
 *
 * This module stores triples in a LMDB embedded store, organized
 * into named graphs. The store is optimized and indexed for fast lookup of any
 * number of bound terms.
 *
 * The store must be first initialized once, to create the environment files
 * and folders as well as the internal databases, then it must be opened once
 * per session. Within that session multiple R/W operations can be performed
 * using transactions.
 *
 * This store supports transactions. Under the hood, LMDB supports nested RW
 * transactions, which are used here, but not exposed to the caller. Some
 * functions have a transaction handle parameter that may be NULL. In that
 * case, a new transaction is opened and closed within the scope of the
 * function (or, in cases such as #mdbstore_lookup(), within the life cycle of
 * the iterator); if not, the transaction handle may either be used as the
 * parent for a new transaction (which is closed as in the previous case), or
 * the function uses the same transaction (i.e. changes are only committed 
 * after the parent transaction is committed).
 */


#ifndef _LSUP_STORE_MDB_H
#define _LSUP_STORE_MDB_H

#include "lmdb.h"

#include "buffer.h"
#include "store_interface.h"


// FIXME find a better cross-platform path.
/// Default MDB store identifier and location.
#define LSUP_MDB_STORE_URN "file://" TMPDIR "/mdb_store"

/// MDB store interface.
extern const LSUP_StoreInt mdbstore_int;

#endif  /* _LSUP_STORE_MDB_H */
